#P1 利用蒙特卡罗方法计算圆周率
#[0,1]随机产生m(m=10000)个点
#找到与中心点(0,0)距离为1的所有点n
#pi=4*n/m

# from random import random
# m = 10000
# n = 0
# for i in range(1,m):
#     x,y = random(),random()
#     dis = pow(x**2+y**2,0.5) #dis = (x^2+y^2)^0.5
#     if dis <= 1:
#         n += 1
# pi = 4*n/m
# print(n)
# print("圆周率为{}".format(pi))
# print(f"圆周率为{pi}")




#P2 实现一个斐波那契数列的程序代码
#0 1 1 2 3 5 8 13 …… F(n)=F(n-1)+F(n-2)

# i,j = 0,1
# while i < 10000:
#     print(i,end=" ")
#     i,j = j,i+j




#P3 求出100-200之间所有素数的和

# sum = 0
# for i in range(100,200):
#     flag = 1
#     for j in range(2,i-1):
#         if i%j == 0:
#             flag = 0
#     if flag == 1:
#         print(i,end=" ")
#         sum += i
# print()
# print(sum)




#P4 打印实心三角形

# n = int(input("请输入三角形直角边长:"))
# for i in range(1,n+1):
#     # print("i=%d"%i,end=" ")
#     for j in range(0,i):
#         # print("j=%d"%j,end=" ")
#         print("*",end=" ")
#     print()


#P5 打印空心三角形

# n = int(input("请输入三角形直角边长:"))
# for i in range(1,n+1):
#     # print("i=%d"%i,end=" ")
#     for j in range(0,i):
#         # print("j=%d"%j,end=" ")
#         if j==0 or j==i-1 and i != n:
#             print("*",end=" ")
#         elif i == n:
#             print("*",end=" ")
#         else:
#             print(end="  ")
#     print()




#P6 百元面钞转换为10,5,1组合

# print("十元个数 五元个数 一元个数")
# for i in range(0,11): #10元个数i
#     for j in range(0,21-2*i): #5元个数j
#         k = 100-10*i-5*j #1元个数k
#         print("%-7d %-7d %-7d"%(i,j,k))



#P7 求100以内能被3和7整除的数
# for i in range(1,100):
#     if i%3 == 0 and i%7 == 0:
#         print(i,end=" ")












